package middleware

import (
	"github.com/cloudwego/hertz/pkg/app/server"
	"github.com/hertz-contrib/cors"
)

func Cors(h *server.Hertz) {
	h.Use(cors.New(cors.Config{
		AllowOrigins:     []string{"*"},              // Allowed domains, need to bring schema
		AllowMethods:     []string{"*"},              // Allowed request methods
		AllowHeaders:     []string{"Origin"},         // Allowed request headers
		ExposeHeaders:    []string{"Content-Length"}, // Request headers allowed in the upload_file
		AllowCredentials: true,                       // Whether cookies are attached
	}))
}
